local extension = Package:new("mahjong_cards", Package.CardPack)
extension.extensionName = "gm_mahjong"
extension.game_modes_whitelist = {
  "mahjong_que",
}
extension:loadSkillSkelsByPath("./packages/gm_mahjong/pkg/mahjong_cards/skills")

local KleeU = require "packages/gm_mahjong/utility/k_utility"

local card_skels = {}
for j,suit in ipairs(KleeU.suits) do
  for i = 1,9 do
    if not (i > 7 and suit == "z") then
      if i ~= 5 or suit == "z" then
        local mahjong = KleeU.Mahjong:new(suit, i)
        table.insert(card_skels, fk.CreateCard{
          name = mahjong:getCardName(),
          skill = "mahjong_cardskel_base",
          type = Card.TypeBasic,
        })
        
        Fk:loadTranslationTable{ [mahjong:getCardName()] = mahjong:getCardTrans() }
        Fk:loadTranslationTable{ [":" .. mahjong:getCardName()] = "" }
        extension:addCardSpec(mahjong:getCardName(), j+5, i+13)
        extension:addCardSpec(mahjong:getCardName(), j+5, i+13)
        extension:addCardSpec(mahjong:getCardName(), j+5, i+13)
        extension:addCardSpec(mahjong:getCardName(), j+5, i+13)
      else
        local mahjong = KleeU.Mahjong:new(suit, i)
        local name = mahjong:getCardName()
        local baopai = KleeU.Mahjong:new(suit, i, true)
        table.insert(card_skels, fk.CreateCard{
          name = baopai:getCardName(),
          skill = "mahjong_cardskel_base",
          type = Card.TypeBasic,
        })
        table.insert(card_skels, fk.CreateCard{
          name = name,
          skill = "mahjong_cardskel_base",
          type = Card.TypeBasic,
        })
        Fk:loadTranslationTable{ [baopai:getCardName()] = baopai:getCardTrans()}
        Fk:loadTranslationTable{ [":" .. baopai:getCardName()] = "" }
        Fk:loadTranslationTable{ [name] = mahjong:getCardTrans() }
        Fk:loadTranslationTable{ [":" .. name] = "" }
        extension:addCardSpec(name, j+5, i+13)
        extension:addCardSpec(name, j+5, i+13)
        extension:addCardSpec(name, j+5, i+13)
        extension:addCardSpec(baopai:getCardName(), j+5, 0)
      end
    end
  end
end

extension:loadCardSkels(card_skels)

Fk:loadTranslationTable{
  ["mahjong_cards"] = "麻将牌堆",
}


return extension